//
//  StatusRetweetedView.swift
//  weibo19
//
//  Created by Arvin on 15/11/15.
//  Copyright © 2015年 Arvin. All rights reserved.
//

import UIKit

class StatusRetweetedView: UIView {
    var retweetedStatus: Status? {
        didSet {
            // textLabel.text = retweetedStatus?.text
            textLabel.attributedText = EmoticonManeger.shareEmoticonManager.stringToImageTextAttrubed(retweetedStatus?.text, font: textLabel.font)
            pictureView.pic_URLs = retweetedStatus?.pic_URLs
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = UIColor(white: 0.98, alpha: 1.0)
        setupUI()
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI() {
        addSubview(textLabel)
        addSubview(pictureView)
        pictureView.backgroundColor = UIColor(white: 0.98, alpha: 1.0)
        textLabel.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(snp_top)
            make.left.equalTo(snp_left).offset(StatusCellMargin)
        }
        
        pictureView.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(textLabel.snp_bottom).offset(StatusCellMargin)
            make.left.equalTo(textLabel)
        }
        
        self.snp_makeConstraints { (make) -> Void in
            make.bottom.equalTo(pictureView.snp_bottom).offset(StatusCellMargin)
        }
    }
    
    // margin -> 用CGFloat强转
    private lazy var textLabel: UILabel = UILabel(title: "转发微博", size: UIFont.systemFontOfSize(14), margin: CGFloat(StatusCellMargin))
    private lazy var pictureView: StatusPictureView = StatusPictureView()
    
}
